﻿
package client;
import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Color;

import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JEditorPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.awt.Font;


public class ResLoginGUI extends JDialog
{

	private JPanel contentPane;
	private JPasswordField passwordField;
	private JTextField textField;

	/*

	 public static void main(String[] args){
		 EventQueue.invokeLater(new Runnable(){
			 	 
			public void run() {
				try {
					ResLoginGUI frame = new ResLoginGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
});
}
	 
	*/ 
	 
	public ResLoginGUI() {
		setTitle("\u767B\u9646");
	setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 376, 298);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
		label.setFont(new Font("方正舒体", Font.PLAIN, 18));
		label.setBounds(51, 42, 72, 15);
		contentPane.add(label);
		
		passwordField = new JPasswordField();
		passwordField.setBounds(145, 97, 161, 21);
		contentPane.add(passwordField);
		
		textField = new JTextField();
		textField.setBounds(145, 41, 161, 21);
		contentPane.add(textField);
		textField.setColumns(10);
		
		JLabel label_1 = new JLabel("\u5BC6\u7801\uFF1A");
		label_1.setFont(new Font("方正舒体", Font.PLAIN, 18));
		label_1.setBounds(51, 98, 54, 15);
		contentPane.add(label_1);
		
		JButton btnNewButton = new JButton("\u7BA1\u7406\u4EBA\u5458\u767B\u9646");
		btnNewButton.setFont(new Font("方正舒体", Font.PLAIN, 18));
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {String number=textField.getText();
				String password=passwordField.getText();
			//	getPassword(number);
				boolean x=(number.equals("admin") && password.equals("admin"));
				if(x==true)
				{
					//dispose();
				ResManageGUI manage;
				
					manage = new ResManageGUI();
					manage.setModal(true);
					manage.setLocationRelativeTo(null);
				manage.setVisible(true);
				}
				else
				{
					JOptionPane.showMessageDialog(null, "用户名或密码输入错误");
					textField.setText("");
					passwordField.setText("");
				}
				} catch (MalformedURLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (RemoteException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (NotBoundException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
			}
		});
		btnNewButton.setBounds(112, 155, 148, 35);
		contentPane.add(btnNewButton);
		
		JButton button = new JButton("应聘");
		button.setFont(new Font("方正舒体", Font.PLAIN, 18));
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ResApplyGUI apply=new ResApplyGUI();
				apply.setModal(true);
				apply.setLocationRelativeTo(null);
				apply.setVisible(true);
				
			}
		});
		button.setBounds(112, 202, 148, 35);
		contentPane.add(button);
	}
}
